using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Security.Permissions;
namespace AppToolKit.Model.Validation
{
	[Serializable]
	public class ValidateException : Exception, ISerializable
	{
		private const string RESULET_SET_MAGICNUM = "resultset";
		private ValidateResultSet set_;
		public ValidateResultSet ResultSet
		{
			get
			{
				return this.set_;
			}
			set
			{
				this.set_ = value;
			}
		}
		public override string Message
		{
			get
			{
				string result;
				if (this.ResultSet != null)
				{
					result = this.ResultSet.GetError();
				}
				else
				{
					result = string.Empty;
				}
				return result;
			}
		}
		public ValidateException(ValidateResultSet resultSet)
		{
			this.set_ = resultSet;
		}
		public ValidateException(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			this.set_ = new ValidateResultSet();
			this.set_.Resuls = (info.GetValue("resultset", typeof(List<ValidateResult>)) as List<ValidateResult>);
		}
		public ValidateException()
		{
		}
		[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			base.GetObjectData(info, context);
			info.AddValue("resultset", this.set_.Resuls);
		}
	}
}
